package com.exam.project.business.domain;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.exam.common.utils.DateUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.exam.framework.aspectj.lang.annotation.Excel;
import com.exam.framework.web.domain.BaseEntity;

/**
 * 考试表对象 exam
 *
 * @author qiuwenbing
 * @date 2025-04-03
 */
public class Exam extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * $column.columnComment
     */
    private Long id;

    /**
     * 考试名称
     */
    @Excel(name = "考试名称")
    private String examName;

    /**
     * 考试开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "考试开始时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date startTime;
    private String startTimeStr;

    /**
     * 考试结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "考试结束时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date endTime;
    private String endTimeStr;

    /**
     * 考试时长（分钟）
     */
    @Excel(name = "考试时长", readConverterExp = "分=钟")
    private Long duration;

    /**
     * 考试整体难度，如简单、中等、困难
     */
    @Excel(name = "考试整体难度，如简单、中等、困难")
    private String difficultyLevel;

    /**
     * 考试总分数
     */
    @Excel(name = "考试总分数")
    private Long totalScore;

    @Excel(name = "总题目数量")
    private Integer totalNum;


    /**
     * 考试状态
     */
    @Excel(name = "考试状态")
    private Long status;

    private Boolean submit;

    public Boolean getSubmit() {
        return submit;
    }

    public void setSubmit(Boolean submit) {
        this.submit = submit;
    }

    public Integer getTotalNum() {
        return totalNum;
    }

    public void setTotalNum(Integer totalNum) {
        this.totalNum = totalNum;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setExamName(String examName) {
        this.examName = examName;
    }

    public String getExamName() {
        return examName;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setDuration(Long duration) {
        this.duration = duration;
    }

    public Long getDuration() {
        return duration;
    }

    public void setDifficultyLevel(String difficultyLevel) {
        this.difficultyLevel = difficultyLevel;
    }

    public String getDifficultyLevel() {
        return difficultyLevel;
    }

    public void setTotalScore(Long totalScore) {
        this.totalScore = totalScore;
    }

    public Long getTotalScore() {
        return totalScore;
    }

    public void setStatus(Long status) {
        this.status = status;
    }

    public Long getStatus() {
        return status;
    }

    public String getStartTimeStr() {
        if (startTime != null) {
            return DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", startTime);
        } else {
            return startTimeStr;
        }
    }

    public void setStartTimeStr(String startTimeStr) {
        if (startTime != null) {
            this.startTimeStr = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", startTime);
        } else {
            this.startTimeStr = startTimeStr;
        }
    }

    public String getEndTimeStr() {
        if (endTime != null) {
            return DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", endTime);
        } else {
            return endTimeStr;
        }
    }

    public void setEndTimeStr(String endTimeStr) {
        if (endTime != null) {
            this.endTimeStr = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", endTime);
        } else {
            this.endTimeStr = endTimeStr;
        }
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("examName", getExamName())
                .append("startTime", getStartTime())
                .append("endTime", getEndTime())
                .append("duration", getDuration())
                .append("difficultyLevel", getDifficultyLevel())
                .append("totalScore", getTotalScore())
                .append("status", getStatus())
                .append("createTime", getCreateTime())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
